<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>判断与循环 | Qin-BookNote</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../note/js/function.html" />
    
    
    <link rel="prev" href="../../note/js/computer.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.4"
        data-chapter-title="判断与循环"
        data-filepath="note/js/xunhuan.md"
        data-basepath="../.."
        data-revision="Wed Sep 20 2017 11:13:21 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="note/html/1.html">
            
                
                    <a href="../../note/html/1.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        HTML
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="note/html/jianjie.html">
            
                
                    <a href="../../note/html/jianjie.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        HTML的简介和标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="note/html/emmet.html">
            
                
                    <a href="../../note/html/emmet.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        emmet
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="note/html/text.html">
            
                
                    <a href="../../note/html/text.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        实体字符与文本
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="note/html/yuyi.html">
            
                
                    <a href="../../note/html/yuyi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        H5的语义化标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="note/html/biao.html">
            
                
                    <a href="../../note/html/biao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        表格
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="note/html/table.html">
            
                
                    <a href="../../note/html/table.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.1.</b>
                        
                        table表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="note/html/form.html">
            
                
                    <a href="../../note/html/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.2.</b>
                        
                        form表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="note/html/input.html">
            
                
                    <a href="../../note/html/input.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.3.</b>
                        
                        input属性
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="note/html/lianlie.html">
            
                
                    <a href="../../note/html/lianlie.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        链接和列表
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="note/html/libiao.html">
            
                
                    <a href="../../note/html/libiao.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.1.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="note/html/lianjie.html">
            
                
                    <a href="../../note/html/lianjie.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.2.</b>
                        
                        超链接
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="note/html/media.html">
            
                
                    <a href="../../note/html/media.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        多媒体
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="note/html/audio.html">
            
                
                    <a href="../../note/html/audio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.1.</b>
                        
                        音频和视频
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="note/html/head.html">
            
                
                    <a href="../../note/html/head.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        head
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="note/html/meta.html">
            
                
                    <a href="../../note/html/meta.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.1.</b>
                        
                        meta标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="note/html/link.html">
            
                
                    <a href="../../note/html/link.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.2.</b>
                        
                        link标签
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="note/css/css.html">
            
                
                    <a href="../../note/css/css.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="note/css/xuanze.html">
            
                
                    <a href="../../note/css/xuanze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        选择器
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="note/css/yuansu.html">
            
                
                    <a href="../../note/css/yuansu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.1.</b>
                        
                        元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="note/css/csxuanze.html">
            
                
                    <a href="../../note/css/csxuanze.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.2.</b>
                        
                        关系选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="note/css/ziyuan.html">
            
                
                    <a href="../../note/css/ziyuan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.3.</b>
                        
                        子元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="note/css/shuxing.html">
            
                
                    <a href="../../note/css/shuxing.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.4.</b>
                        
                        属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="note/css/weilei.html">
            
                
                    <a href="../../note/css/weilei.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.5.</b>
                        
                        伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="note/css/duixiang.html">
            
                
                    <a href="../../note/css/duixiang.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.6.</b>
                        
                        伪对象选择符
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="note/css/zi.html">
            
                
                    <a href="../../note/css/zi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        字体
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="note/css/font.html">
            
                
                    <a href="../../note/css/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.1.</b>
                        
                        font
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="note/css/icon.html">
            
                
                    <a href="../../note/css/icon.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.2.</b>
                        
                        icon
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2.3" data-path="note/css/wenben.html">
            
                
                    <a href="../../note/css/wenben.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.3.</b>
                        
                        文本装饰
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="note/css/biankuan.html">
            
                
                    <a href="../../note/css/biankuan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        border
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="note/css/border.html">
            
                
                    <a href="../../note/css/border.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.1.</b>
                        
                        边框
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="note/css/tu.html">
            
                
                    <a href="../../note/css/tu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.2.</b>
                        
                        圆角与背景
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="note/css/hezi.html">
            
                
                    <a href="../../note/css/hezi.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="note/css/float.html">
            
                
                    <a href="../../note/css/float.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="note/css/position.html">
            
                
                    <a href="../../note/css/position.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="note/css/scss.html">
            
                
                    <a href="../../note/css/scss.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        SCSS
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="note/css/donghua.html">
            
                
                    <a href="../../note/css/donghua.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="note/css/viewport.html">
            
                
                    <a href="../../note/css/viewport.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        viewport
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="note/css/buju.html">
            
                
                    <a href="../../note/css/buju.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="note/css/rem.html">
            
                
                    <a href="../../note/css/rem.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        rem的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="note/css/shan.html">
            
                
                    <a href="../../note/css/shan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        响应式布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="note/css/flex.html">
            
                
                    <a href="../../note/css/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        flex
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="note/js/javascript.html">
            
                
                    <a href="../../note/js/javascript.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        javascript解析器脚本
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="note/js/js.html">
            
                
                    <a href="../../note/js/js.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        什么是js
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="note/js/use.html">
            
                
                    <a href="../../note/js/use.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        js的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="note/js/computer.html">
            
                
                    <a href="../../note/js/computer.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.4" data-path="note/js/xunhuan.html">
            
                
                    <a href="../../note/js/xunhuan.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        判断与循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="note/js/function.html">
            
                
                    <a href="../../note/js/function.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        function函数
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="note/js/dom.html">
            
                
                    <a href="../../note/js/dom.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        DOM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="note/js/array.html">
            
                
                    <a href="../../note/js/array.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        Array
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="note/js/math.html">
            
                
                    <a href="../../note/js/math.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        Math
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="note/js/Date.html">
            
                
                    <a href="../../note/js/Date.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        Date
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >Qin-BookNote</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5224;&#x65AD;&#x4E0E;&#x5FAA;&#x73AF;">&#x5224;&#x65AD;&#x4E0E;&#x5FAA;&#x73AF;</h1>
<h2 id="if&#x5224;&#x65AD;">if&#x5224;&#x65AD;</h2>
<blockquote>
<p>if()&#x7684;&#x62EC;&#x53F7;&#x5FC5;&#x987B;&#x6709;</p>
<pre><code>            var i = 12;
            if(i==1){
                alert(&quot;i=1&quot;);
            }
            else if(i==2){
                alert(&quot;i=2&quot;);
            }
            else if(i==3){
                alert(&quot;i=3&quot;);
            }
            else{
                alert(&quot;i&#x662F;&#x591A;&#x5C11;&quot;); 
                //&#x4EE5;&#x4E0A;&#x60C5;&#x51B5;&#x90FD;&#x4E0D;&#x7B26;&#x5408;
            }
</code></pre><h2 id="switch&#x5224;&#x65AD;">switch&#x5224;&#x65AD;</h2>
<pre><code>&#x7EC3;&#x4E60;&#xFF1A;&#x6839;&#x636E;&#x8F93;&#x5165;&#x6210;&#x7EE9;&#xFF0C;&#x5224;&#x65AD;&#x8FD9;&#x4E2A;&#x6210;&#x7EE9;&#x5C5E;&#x4E8E;&#x90A3;&#x4E2A;&#x7EA7;&#x522B;
</code></pre><pre><code>    var num = prompt(&quot;&#x8BF7;&#x8F93;&#x5165;&#x6210;&#x7EE9;&#xFF0C;&#x5224;&#x65AD;&#x7EA7;&#x522B;&quot;,&quot;0&quot;);
//            prompt&#x5F39;&#x51FA;&#x8F93;&#x5165;&#x6846;&#x3002;
//            var num = true;
//            &#x5F00;&#x5173;&#x5F00;&#x542F;&#x7684;&#x6761;&#x4EF6;&#x662F;&#xFF1A;&#x53C2;&#x6570;num&#x4E0E;case&#x7684;&#x7ED3;&#x679C;&#x5168;&#x7B49;&#x4E8E;&#x7684;&#x65F6;&#x5019;&#x624D;&#x80FD;&#x901A;&#x8FC7;
    switch(true){
    case (num&gt;=0&amp;&amp;num&lt;60):
    //case &#x540E;&#x9762;&#x53EF;&#x4EE5;&#x8DDF;&#x7740;&#x6570;&#x503C;&#xFF0C;&#x6BD4;&#x8F83;&#x8FD0;&#x7B97;&#x4E4B;&#x540E;&#x7684;&#x7ED3;&#x679C;(&#x5E03;&#x5C14;&#x503C;)&#xFF0C;&#x5B57;&#x7B26;&#x4E32;
        alert(&quot;&#x4E0D;&#x53CA;&#x683C;&quot;);
    //&#x5B8C;&#x6210;&#x4E86;&#x5206;&#x652F;&#x5185;&#x7684;&#x4EE3;&#x7801;&#x540E;&#xFF0C;&#x76F4;&#x63A5;&#x8DF3;&#x51FA;switch
        break;
        case (num&gt;=60&amp;&amp;num&lt;80):
            alert(&quot;&#x4E2D;&quot;);
            break;
        case (num&gt;=80&amp;&amp;num&lt;96):
            alert(&quot;&#x826F;&quot;);
            break;
        case (num&gt;=96&amp;&amp;num&lt;=100):
            alert(&quot;&#x4F18;&quot;);
            break;    
        default:
    //&#x9ED8;&#x8BA4;&#xFF0C;&#x5982;&#x679C;&#x524D;&#x9762;&#x7684;&#x5206;&#x652F;&#x90FD;&#x4E0D;&#x7B26;&#x5408;&#x6216;&#x8005;&#x6CA1;&#x6709;&#x8DF3;&#x51FA;switch&#xFF0C;&#x90A3;&#x4E48;&#x90FD;&#x4F1A;&#x8D70;&#x8FDB;default
            alert(&quot;&#x8F93;&#x51FA;&#x7684;&#x6570;&#x5B57;&#x90FD;&#x4E0D;&#x7B26;&#x5408;&quot;);
            break;
            }
</code></pre><p>&#x5FC5;&#x987B;&#x5728;&#x8BED;&#x53E5;&#x540E;&#x9762;&#x52A0;break&#xFF0C;&#x4E0D;&#x7136;&#x4E0D;&#x4F1A;&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;&#xFF0C;&#x4E00;&#x76F4;&#x5230;&#x5FAA;&#x73AF;&#x7ED3;&#x675F;</p>
</blockquote>
<h2 id="&#x5FAA;&#x73AF;&#xFF08;while&#xFF09;">&#x5FAA;&#x73AF;&#xFF08;while&#xFF09;</h2>
<p>&#x8BA9;&#x8BA1;&#x7B97;&#x673A;&#x505A;&#x91CD;&#x590D;&#x7684;&#x52A8;&#x4F5C;
&#x5FAA;&#x73AF;+&#x6761;&#x4EF6;
&#x6709;&#x9650;&#x548C;&#x53EF;&#x63A7;&#x5236;&#x7684;&#x5FAA;&#x73AF;</p>
<blockquote>
<p>&#x5C0F;&#x5FC3;&#x6B7B;&#x5FAA;&#x73AF; </p>
</blockquote>
<h3 id="while--------&#x5F53;&#x7B26;&#x5408;&#x4EC0;&#x4E48;&#x6761;&#x4EF6;&#xFF0C;&#x505A;&#x4EC0;&#x4E48;&#x4E8B;&#xFF0C;&#x76F4;&#x5230;&#x6761;&#x4EF6;&#x4E0D;&#x7B26;&#x5408;&#x624D;&#x7ED3;&#x675F;">while        &#x5F53;&#x7B26;&#x5408;&#x4EC0;&#x4E48;&#x6761;&#x4EF6;&#xFF0C;&#x505A;&#x4EC0;&#x4E48;&#x4E8B;&#xFF0C;&#x76F4;&#x5230;&#x6761;&#x4EF6;&#x4E0D;&#x7B26;&#x5408;&#x624D;&#x7ED3;&#x675F;</h3>
<p>&#x5148;&#x5224;&#x65AD;&#x6761;&#x4EF6;&#xFF0C;&#x518D;&#x6267;&#x884C;
i&#x4EE3;&#x8868;&#x7B2C;&#x51E0;&#x9875;</p>
<pre><code>    var i = 0;
    while(i&lt;10){
            console.log(&quot;while&#xFF1A;&quot;+i);
                i++;
            }
</code></pre><h3 id="do-while-&#x6765;&#x4E0D;&#x53CA;&#x89E3;&#x91CA;&#xFF0C;&#x5FEB;&#x4E0A;&#x8F66;">do while &#x6765;&#x4E0D;&#x53CA;&#x89E3;&#x91CA;&#xFF0C;&#x5FEB;&#x4E0A;&#x8F66;</h3>
<p>&#x5148;&#x6267;&#x884C;&#x4E00;&#x904D;&#xFF0C;&#x518D;&#x5224;&#x65AD;&#x6761;&#x4EF6;</p>
<pre><code>            var j = 0;
            do{
            console.log(&quot;do while:&quot;+j);
                j++;
            }while(j&lt;0)
</code></pre><h2 id="for">for</h2>
<ol>
<li>&#x5728;&#x5FAA;&#x73AF;&#x524D;&#x53EF;&#x4EE5;&#x5B9A;&#x4E49;&#x53D8;&#x91CF;</li>
<li>&#x5224;&#x65AD;&#x5FAA;&#x73AF;&#x7684;&#x6761;&#x4EF6;&#x662F;&#x5426;&#x7B26;&#x5408;</li>
<li>&#x6267;&#x884C;{}&#x5185;&#x7684;&#x4EE3;&#x7801;</li>
<li>&#x6267;&#x884C;{}&#x5185;&#x7684;&#x4EE3;&#x7801;&#x540E;,&#x5728;&#x6267;&#x884C;&#x7684;&#x4E00;&#x53E5;&#x4EE3;&#x7801;
```
var apple = 10;
k&#x4EE3;&#x8868;&#x62FF;&#x5230;&#x82F9;&#x679C;&#x7684;&#x4EBA;&#x6570;
 for(var k=0;k&lt;apple;k++){<pre><code>         console.log(&quot;apple:&quot;+k);
     }
</code></pre></li>
</ol>
<pre><code>&#x6267;&#x884C;&#x5B8C;&#x4EE5;&#x4E0A;&#x4EE3;&#x7801;&#x4E4B;&#x540E;&#xFF0C;&#x76F4;&#x63A5;&#x7ED3;&#x675F;&#x5FAA;&#x73AF;

##for in
</code></pre><p>for(var k in obj){
                 console.log(k);
}
```
&#x5728;&#x539F;&#x578B;&#x4E0A;&#x6269;&#x5C55;&#x7684;&#x53EF;&#x679A;&#x4E3E;&#x65B9;&#x6CD5;&#xFF0C;&#x4F1A;&#x88AB;for in&#x5FAA;&#x73AF;&#x51FA;&#x6765;
for&#x5FAA;&#x73AF;&#x662F;&#x6309;&#x987A;&#x5E8F;&#x7684;&#xFF0C;for in&#x5FAA;&#x73AF;&#x662F;&#x4E0D;&#x4E00;&#x5B9A;&#x6309;&#x987A;&#x5E8F;&#x7684; </p>
<h2 id="for-of">for of</h2>
<p>&#x679A;&#x4E3E;&#x7684;&#x662F;&#x503C;</p>
<h2 id="foreach">forEach</h2>
<p>&#x5BF9;&#x6570;&#x7EC4;&#x7684;&#x6BCF;&#x4E2A;&#x5143;&#x7D20;&#x6267;&#x884C;&#x4E00;&#x6B21;&#x63D0;&#x4F9B;&#x7684;&#x51FD;&#x6570;</p>
<h4 id="break">break</h4>
<p>&#x8DF3;&#x51FA;&#x5FAA;&#x73AF;</p>
<h4 id="continue">continue</h4>
<p>&#x6267;&#x884C;&#x4E0B;&#x4E00;&#x5FAA;&#x73AF;</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../note/js/computer.html" class="navigation navigation-prev " aria-label="Previous page: 运算符"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../note/js/function.html" class="navigation navigation-next " aria-label="Next page: function函数"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"anchor-navigation-ex":{"isRewritePageTitle":true,"isShowTocTitleIcon":true,"tocLevel1Icon":"fa fa-hand-o-right","tocLevel2Icon":"fa fa-hand-o-right","tocLevel3Icon":"fa fa-hand-o-right"},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
